package com.lantosec.hmrp.modules.supplier.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.lantosec.hmrp.core.mvc.BaseEntity;
import com.lantosec.hmrp.modules.supplier.vo.SupplierInfoVO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * <p>
 * 供应商信息 实体类
 * </p>
 *
 * @author AutoCode
 * @since 2020-02-20
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class SupplierInfo extends BaseEntity<SupplierInfoVO> {

    private static final long serialVersionUID = 1L;
    public SupplierInfo(SupplierInfoVO vo){
        this.supplierCode = vo.getSupplierCode();
        this.supplierName = vo.getSupplierName();
        this.supplierProvince = vo.getSupplierProvince();
        this.supplierCity = vo.getSupplierCity();
        this.supplierType = vo.getSupplierType();
        this.supplierNature = vo.getSupplierNature();
        this.supplierIndustry = vo.getSupplierIndustry();
        this.supplierScale = vo.getSupplierScale();
        this.linkmanId = vo.getLinkmanId();
        this.createTime = vo.getCreateTime();
        this.createDeptId = vo.getCreateDeptId();
        this.createDeptName = vo.getCreateDeptName();
        this.createUserId = vo.getCreateUserId();
        this.createUser = vo.getCreateUser();
        this.businessLicense = vo.getBusinessLicense();
        this.uscc = vo.getUscc();
        this.businessName = vo.getBusinessName();
        this.businessBegin = vo.getBusinessBegin();
        this.businessEnd = vo.getBusinessEnd();
        this.businessScope = vo.getBusinessScope();
        this.businessAddress = vo.getBusinessAddress();
        this.legalRepresentative = vo.getLegalRepresentative();
        this.blacklistFlag = vo.getBlacklistFlag();
        this.entryState = vo.getEntryState();
        this.username = vo.getUsername();
        this.phone = vo.getPhone();
    }

    @Override
    public SupplierInfoVO convertToVO(){
        return new SupplierInfoVO(this);
    }


    /**
     * 供应商编码
     */
    @TableId(value = "supplier_code", type = IdType.ASSIGN_UUID)
    private String supplierCode;

    /**
     * 供应商名称
     */
    private String supplierName;

    /**
     * 省份
     */
    private String supplierProvince;

    /**
     * 城市
     */
    private String supplierCity;

    /**
     * 供应商性质，字典表ID
     */
    private String supplierNature;

    /**
     * 供应商类型
     */
    private String supplierType;

    /**
     * 供应商所属行业，字典表ID集合
     */
    private String supplierIndustry;

    /**
     * 供应商规模，字典表ID集合
     */
    private String supplierScale;

    /**
     * 联系人ID
     */
    private String linkmanId;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 创建部门ID
     */
    private String createDeptId;

    /**
     * 创建部门名称
     */
    private String createDeptName;

    /**
     * 创建用户ID
     */
    private String createUserId;

    /**
     * 创建用户名称
     */
    private String createUser;

    /**
     * 营业执照附件ID
     */
    private String businessLicense;

    /**
     * 统一社会信用代码
     */
    private String uscc;

    /**
     *营业执照名称
     */
    private String businessName;

    /**
     * 营业执照开始日期(yyyy-MM-dd)
     */
    private String businessBegin;

    /**
     * 营业执照结束日期(yyyy-MM-dd或常期)
     */
    private String businessEnd;

    /**
     * 经营范围
     */
    private String businessScope;

    /**
     * 经营地址
     */
    private String businessAddress;

    /**
     * 法定代表人
     */
    private String legalRepresentative;

    /**
     * 是否拉入黑名单(0否,1是)
     */
    private Boolean blacklistFlag;

    /**
     * "供应商联系人头衔
     */
    @TableField(exist = false)
    private String linkmanTitle;

    /**
     * "供应商联系人姓名"
     */
    @TableField(exist = false)
    private String linkmanName;

    /**
     * "供应商联系人电话"
     */
    @TableField(exist = false)
    private String linkmanTel;

    /**
     * "准入状态(0正常1未审核2审核中3过期4停用)"
     */
    @TableField(exist = false)
    private int entryState;

    /**
     * 供应商联系人姓名
     */
    private String username;

    /**
     * "供应商联系人电话
     */
    private String phone;

    /**
     * "文件保存路径"
     */
    @TableField(exist = false)
    private String savePath;

    @TableField(exist = false)
    private String supplierTypeName;

    @TableField(exist = false)
    private String supplierNatureName;

    @TableField(exist = false)
    private String supplierIndustryName;

    @TableField(exist = false)
    private String supplierScaleName;

    public enum ColName {
        supplier_code, supplier_name, supplier_province, supplier_city, supplier_type, supplier_nature, supplier_scale, supplier_industry, supplier_state, linkman_id, create_time, create_dept_id, create_dept_name, create_user_id, create_user, business_license, uscc, business_begin, business_end, business_scope, business_address, legal_representative, stop_flag, blacklist_flag, 
    }
}
